﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GeneratorLib.DB;
using GeneratorLib.DB.Connectios;
using GeneratorLib.DB.Schemas;

namespace GeneratorCode.Pasys
{
    public class ServerControl
    {
        public static string GetExtracterMethodName(FieldInfo field)
        {
            return GetExtracterMethodName(field,false);
        }

        public static string GetExtracterMethodName(FieldInfo field,bool chkNullabled)
        {
            string methodName = "";
            switch (field.FieldType.MapName.ToLower())
            {
                case "int":
                    if (field.Nullabled && chkNullabled)
                        methodName = "ExtractNullableInt";
                    else
                        methodName = "ExtractInt";
                    break;
                case "datetime":
                    if (field.Nullabled && chkNullabled)
                        methodName = "ExtractNullableDateTime";
                    else
                        methodName = "ExtractDateTime";
                    break;
                case "decimal":
                    if (field.Nullabled && chkNullabled)
                        methodName = "ExtractNullableDecimal";
                    else
                        methodName = "ExtractDecimal";
                    break;
                case "bool":
                    methodName = "ExtractBoolean";
                    break;
                case "string":
                    methodName = "ExtractString";
                    break;
                default:
                    break;
            }

            return methodName;
        }


    }
}
